  import {reqCategoryList,reqBannerList,reqFloorList} from '@/network';


  const state = {
    categoryList: [],
    bannerList: [],
    floorList: []
  }

  const mutations = {
    RECEIVE_CATEGORY(state,categoryList) {
        state.categoryList = categoryList;
    },
    RECEIVE_BANNER(state,bannerList) {
        state.bannerList = bannerList;
    },
    RECEIVE_FLOOR(state,floorList) {
        state.floorList = floorList;
    },
  }

  const actions = {
    async  getCategoryList({commit}) {
        //发请求，拿数据  await   async
        const result = await reqCategoryList();
        if (result.code === 200) {
            commit('RECEIVE_CATEGORY',result.data)
        };
      },
    async  getBannerList({commit}) {
      //发请求，拿数据  await   async
      const result = await reqBannerList();
      if (result.code === 200) {
          commit('RECEIVE_BANNER',result.data)
      }
    },
    async  getFloorList({commit}) {
      //发请求，拿数据  await   async
      const result = await reqFloorList();
      if (result.code === 200) {
          commit('RECEIVE_FLOOR',result.data)
      }
    },
  }

  const getters = {

  }

  export default {
      state,
      mutations,
      actions,
      getters
  }